const container = document.querySelector('#container');
const signInButton = document.querySelector('#signIn');
const signUpButton = document.querySelector('#signUp');
signUpButton.addEventListener('click', () => container.classList.add('right-panel-active'))
signInButton.addEventListener('click', () => container.classList.remove('right-panel-active'))

function confirmName() {
  var name = document.getElementById("username");
  name.onblur = function () {
    if ((name.value).length != 0) {
      reg = /^[0-9]{6,16}$/g;    //账号只能是6-16位的数字
      if (!reg.test(name.value)) {
        alert("对不起，输入的用户名限6-16个数字 ");
      }
    }
    else {
      alert("输入用户名不能为空");
    }
  };
}
function confirmPassword() {
  var password = document.getElementById("password");
  password.onblur = function () {
    if ((password.value).length != 0) {  //密码限制位6-20位的数字和英文 不能有特殊字符
      reg = /^(\w){6,20}$/;
      if (!reg.test(password.value)) {
        alert("密码限制位6-20位的数字和英文 不能有特殊字符");
      }
    }
  };
}

window.onload = function () {
  confirmName();
  confirmPassword();
};